# try:
#     print(8/0)
#     f = open('test.txt','r')
# except (FileNotFoundError,ZeroDivisionError):
#     print('代码出错')
#
# import time
#
# try:
#     f = open('python.txt','r')
#     try:
#         while True:
#             outline = f.read(1)
#             if len(outline) == 0:
#                 break
#             print(outline)
#             time.sleep(3)
#     except:
#         raise Exception('文件读取失败，自定义异常')
#     else:
#         print('文件读取完毕')
#     finally:
#         f.close()
# except:
#     raise Exception('文件不存在，读取失败，自定义异常')
# finally:
#     f = open('python.txt','w')
#     f.write('123456789')

    